#include <stdio.h>
#include <stdlib.h>

#define BIG2SMALL ('A'-'a')
#define MAX 100001
#define ASCMAX 200

int main(int argc, char **argv)
{
	int  i, OutCount = 0;
	int  Broken[ASCMAX] = {0};
	char c;
	char Input[MAX] = {0};
	char Output[MAX] = {0};

	while((c = getchar()) != '\n')
	{
		if(c >= 'A' && c <= 'Z')
			Broken[c - BIG2SMALL]++;
		Broken[c]++;
	}

	gets(Input);

	for(i=0, OutCount=0; Input[i] != '\0'; i++)
	{
		c = Input[i];
		if(Broken[c])
		{
			continue;
		}
		else if(c >= 'A' && c <= 'Z')
		{
			if(Broken['+'])
				continue;
		}
		Output[OutCount++] = c;
	}

	printf("%s", Output);
	return 0;
}